{% extends 'base/base.html' %}

{% block title %}登录 - 环保监测数据管理系统{% endblock %}

{% block extra_css %}
<style>
    .login-container {
        max-width: 420px;
        margin: 80px auto;
    }
    .login-header {
        text-align: center;
        margin-bottom: 30px;
    }
    .login-header h1 {
        color: var(--primary-color);
        font-weight: 600;
    }
    .login-form {
        background-color: #fff;
        padding: 30px;
        border-radius: 5px;
        box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
    }
    .login-footer {
        text-align: center;
        margin-top: 20px;
    }
    .btn-login {
        width: 100%;
        padding: 10px;
        font-weight: 600;
    }
</style>
{% endblock %}

{% block main_content %}
<div class="login-container">
    <div class="login-header">
        <h1>环保监测数据管理系统</h1>
        <p>请登录您的账号</p>
    </div>
    <div class="login-form">
        <form method="post">
            {% csrf_token %}
            <div class="mb-3">
                <label for="{{ form.username.id_for_label }}" class="form-label">{{ form.username.label }}</label>
                {{ form.username }}
                {% if form.username.errors %}
                <div class="invalid-feedback d-block">
                    {{ form.username.errors.0 }}
                </div>
                {% endif %}
            </div>
            <div class="mb-3">
                <label for="{{ form.password.id_for_label }}" class="form-label">{{ form.password.label }}</label>
                {{ form.password }}
                {% if form.password.errors %}
                <div class="invalid-feedback d-block">
                    {{ form.password.errors.0 }}
                </div>
                {% endif %}
            </div>
            {% if form.non_field_errors %}
            <div class="alert alert-danger">
                {% for error in form.non_field_errors %}
                {{ error }}
                {% endfor %}
            </div>
            {% endif %}
            <div class="d-grid gap-2 mt-4">
                <button type="submit" class="btn btn-primary btn-login">登录</button>
            </div>
        </form>
    </div>
    <div class="login-footer">
        <p>还没有账号? <a href="{% url 'accounts:register' %}">立即注册</a></p>
    </div>
</div>
{% endblock %} 